﻿using Mesuro.Common;
namespace Mesuro.Graphing {
	public interface IScale {
		/// <summary>
		/// Gets the scale limits in _data-space
		/// </summary>
		/// <remarks>
		/// All the following must return true.
		/// <code>iScale.ToPlotSpace(iScale.Range.Min)==iScale.Domain.Min</code>
		/// <code>iScale.ToPlotSpace(iScale.Range.Max)==iScale.Domain.Max</code>
		/// <code>iScale.ToDataSpace(iScale.Domain.Min)==iScale.Range.Min</code>
		/// <code>iScale.ToDataSpace(iScale.Domain.Max)==iScale.Range.Min</code>
		/// </remarks>
		Limits Range { get; set; }
		/// <summary>
		/// Gets the scale limits in plot-space
		/// </summary>
		/// <remarks>
		/// All the following must return true.
		/// <code>iScale.ToPlotSpace(iScale.Range.Min)==iScale.Domain.Min</code>
		/// <code>iScale.ToPlotSpace(iScale.Range.Max)==iScale.Domain.Max</code>
		/// <code>iScale.ToDataSpace(iScale.Domain.Min)==iScale.Range.Min</code>
		/// <code>iScale.ToDataSpace(iScale.Domain.Max)==iScale.Range.Min</code>
		/// </remarks>
		Limits Domain { get; set; }
		/// <summary>
		/// Converts a point from _data-space to plot-space.
		/// </summary>
		/// <param seriesKey="d">Data-space point</param>
		/// <returns>The corresponding point in plot-space</returns>
		double ToDataSpace( double d );
		/// <summary>
		/// Converts a point from plot-space to _data-space.
		/// </summary>
		/// <param seriesKey="d">Plot-space point</param>
		/// <returns>The corresponding point in _data-space</returns>
		double ToPlotSpace( double d );
	}
}